<template>
  <div :class="{SearchTop:true,SearchTopch:isbai}"  v-if="echongs">
    <router-link class="searchs" to="">
      <div class="search" @click="tzss">
        <img src="../assets/sech.png" alt="" />
        <div class="toplb">
          <van-swipe
            class="my-swipe"
            :autoplay="3000"
            vertical
            :show-indicators="false"
            :height="100"
          >
            <van-swipe-item
              v-for="(v, i) in echongs.data.datas.navs.searchList"
              :key="i"
              >{{ v.words }}</van-swipe-item
            >
          </van-swipe>
        </div>
      </div>
    </router-link>
    <router-link to="">
      <div :class="{advices:true,advicesch:isbai}">
        <van-icon name="chat-o" />
      </div>
    </router-link>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  name: "SearchTop",
  //
  data() {
    return {
      swiperOptions: {
        autoplay: true,
        loop: true,
      },
      isbai:false
    };
  },
  methods: {
    tzss(){
      this.$router.push("/sousuo")
      // console.log(1111);
    }
  },
  computed: {
    ...mapState(["echongs"]),
  },
  mounted() {
    this.busvue.$on("isDong",(data)=>{
        // console.log(data);
        this.isbai = data
    })
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.toplb {
  position: relative;
  font-size: 0.2rem;
  display: block;
  top: 0.1rem;
  left: 0.45rem;
  height: 20px;
  overflow: hidden;

  // background-color: rgb(129, 255, 156);
  // height: .4rem;
  // width: 2rem;
}
.SearchTop {
  width: 100%;
  height: 1.2rem;
  background-color: rgb(214, 185, 250);
  padding: 0.3rem;
  overflow: hidden;
  display: flex;
  box-sizing: border-box;
  .searchs {
    width: 6.02rem;
    height: 0.6rem;
  }
  .search {
    width: 6.1rem;
    height: 0.512rem;
    border-radius: 0.25rem;
    background-color: rgb(247,247,247);
    position: relative;
    > img {
      width: 0.2rem;
      position: absolute;
      top: 0.16rem;
      left: 0.2rem;
    }
  }
  
  .advices {
    font-size: 0.5rem;
    margin-left: 0.4rem;
    color: rgb(255, 255, 255);
  }
   .advicesch{
    color: rgb(107, 107, 107);

   }
}
.SearchTopch{
  background-color: #fff;
}
</style>
